<template>
  <div class="bd">我是子组件</div>
</template>
<script setup>
import { onBeforeMount, onMounted } from 'vue'

const emits = defineEmits(['updateData'])

const queryAsyncData = async () => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve({
        name: 'qingyi',
        age: '21'
      })
    }, 600)
  })
}

onBeforeMount(() => {
  console.info('child onBeforeMount!')
})

onMounted(async () => {
  console.info('child onMounted!')

  // 这里的异步事件，会阻断父组件的onMounted吗？
  const person = await queryAsyncData()
  emits('updateData', person)
})
</script>
